<!-- 爬取股票记录列表 -->
<template>
  <div class="DealerInfoStyle">

    <!-- 表格 -->
    <el-table :data="crawlStocksTable" border style="width: 100%;min-height: 78%;max-height: 78%;overflow: auto;">
      <el-table-column resizable prop="id" label="id" width="60" align="center">
      </el-table-column>
      <el-table-column resizable prop="status" label="状态" width="auto" min-width="100px" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.status == 1">成功</span>
          <span v-if="scope.row.status == 2">失败</span>
        </template>
      </el-table-column>
      <el-table-column resizable prop="type" label="类型" width="auto" min-width="100px" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.type == 1">新闻</span>
          <span v-if="scope.row.type == 2">股票</span>
        </template>
      </el-table-column>
      <el-table-column resizable prop="add_time" label="添加时间" width="auto" min-width="170px" align="center">
      </el-table-column>


    </el-table>

    <!-- 分页 -->
    <div style="text-align: right; margin-top: 5px;">
      <el-pagination background layout="prev, pager, next,total" :total="total" :page-size="pagesize"
        @current-change="current_change"></el-pagination>
    </div>
  </div>
</template>

<script>
import { crawlerRecords } from "@/utils/api";
export default {
  name: 'crawlStocksInfo',
  data() {
    return {
      crawlStocksTable: [],
      total: 100, //总条数
      pagesize: 10, //指定展示多少条
      currentPage: 1, //当前页码
      titles: '',
      roleHeadgear: null,
      is_public: 0
    };
  },
  mounted() {
    this.get_crawlerRecords()
  },

  methods: {
    // 查询爬取股票记录列表
    async get_crawlerRecords() {
      const res = await crawlerRecords(this.currentPage).catch((err) => {
        return console.error(err);
      });
      if (res && res.status == "200") {
        this.crawlStocksTable = res.data.data.data
        this.total = res.data.data.total
      } else {
        this.$message.error(res.data.message);
      }
    },
    async DisplaySwitchInterface() {
      const res = await crawlerRecords(this.currentPage).catch((err) => {
        return console.error(err);
      });
      if (res && res.status == "200") {
        this.$message.success(res.data.message);
        this.crawlStocksTable = res.data.data.data
        this.total = res.data.data.total
      } else {
        this.$message.error(res.data.message);
      }
    },
    // 分页
    current_change(currentPage) {
      this.currentPage = currentPage;
      this.get_crawlerRecords();
    },
  },
};
</script>
<style>
.cell {
  font-size: 12px;
  white-space: nowrap !important;
}

.el-dialog__body {
  padding: 0 10px !important;
}

.demo-table-expand {
  font-size: 0;
  margin-left: 10px;
}

.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>
<style lang="less" scoped>
.DealerInfoStyle {
  width: 100%;
  padding: 0 10px;
  // background-color: aquamarine;
  height: calc(100vh - 100px);
  // border: 1px #000 solid;

  .cardAdmin {
    position: relative;
    // height: 18%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0;

    border: #ebeef5 solid 1px;
    padding: 0 5px;
    margin-bottom: 2px;


    .formContainer {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      padding: 0;
      align-self: baseline;
      padding-bottom: 40px;
    }

    .formSearch {
      width: 25%;
      min-width: 25%;
      margin: 10px 0;
      height: 40px;
      display: flex;
      justify-content: center;
    }
  }

  .pop-up-form {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    align-self: baseline;
    margin: 10px 0;
    justify-content: center;
    padding-right: 15px;

    .form-options {
      width: 100%;
      min-width: 100%;
      height: 40px;
      display: flex;
      justify-content: center;
      margin: 10px 0;
    }
  }
}
</style>
